<template>
  <div class="wrap">
    <!-- 搜索 -->
    <div>
      <el-card style="width: 100%; height: 100%">
        <!-- 表单搜索 -->
        <!-- <el-form size="mini" ref="batchJsForm" :label-width="formLabelWidth"> -->
        <!-- 表头查询 -->
        <!-- 第一行 -->
        <el-row type="flex" justify="start">
          <el-form size="mini" ref="batchJsForm" :label-width="formLabelWidth">
            <el-input
              placeholder="输入关键字进行过滤"
              v-model="filterText"
              size="mini"
              class="input-with-select"
            >
              <el-button slot="append" icon="el-icon-search"></el-button>
            </el-input>
          </el-form>
          <!-- <FuzzyQueryInput :api="queryUnitsNameList" labelText="机组名称" /> -->
        </el-row>
        <div style="height: 100%">
          <el-tree
            :data="dataTree"
            ref="equipmentTree"
            @node-click="handleCheck"
            :props="defaultProps"
            node-key="id"
            highlight-current
            :default-expanded-keys="defaultExpandedNode"
            :current-node-key="currentKey"
            :filter-node-method="filterNode"
            width="75%"
          >
            <span class="custom-tree-node" slot-scope="{ node, data }">
              <el-tooltip
                class="item"
                effect="dark"
                :content="node.label"
                placement="top-start"
              >
                <span> {{ node.label }} </span>
              </el-tooltip>
            </span>
          </el-tree>
          <!-- node-key="id" -->
        </div>
        <!-- </el-form> -->
        <!-- @check-change="checkChange"  -->
      </el-card>
    </div>

    <!-- 表格 -->
    <div>
      <div class="tableBox">
        <div class="allDIV chartBox">
          <TitleLook :title="'配电网拓扑'"> </TitleLook>
          <div class="chartBox">
            <iframe
              ref="dxt"
              id="iframe"
              :src="dxtUrl"
              frameborder="0"
              width="100%"
              height="100%"
            ></iframe>
          </div>
        </div>
        <div class="allDIV rightBox">
          <TitleLook :title="'储能规划方案'"> </TitleLook>

          <el-descriptions column="1" style="margin-left: 5%">
            <el-descriptions-item label="储能方案名称">{{
              planName
            }}</el-descriptions-item>
            <el-descriptions-item label="规划目标">{{
              energyPlanTarget
            }}</el-descriptions-item>
            <el-descriptions-item label="功率约束">{{
              pconstraint
            }}</el-descriptions-item>
            <el-descriptions-item label="容量约束"
              >{{ energyConstraint }}
            </el-descriptions-item>
            <el-descriptions-item label="规划馈线">{{
              feederId
            }}</el-descriptions-item>
            <el-descriptions-item label="数量约束">{{
              countConstraint
            }}</el-descriptions-item>
          </el-descriptions>

          <div class="underTitle" style="height: 50%">
            <CleanForm
              searShow="false"
              btnShow="false"
              :showColumnHandle="false"
              :api="JDlist"
              :queryParam="queryData"
              :fieldList="headList2"
              :tableOptionWidth="200"
              :showColumnSetting="false"
              :page="false"
              :dialogPage="true"
              :showExportBtn="false"
              :showCheckbox="false"
              ref="windPowerTable2"
              size="mini"
            >
            </CleanForm>
          </div>

          <div style="display: flex; flex-direction: row-reverse; margin: 2%">
            <el-button size="mini" class="butStyle" @click="settings()"
              >容量生成</el-button
            >
          </div>
        </div>
      </div>

      <div style="height: 40%" class="allDIV">
        <TitleLook :title="'潮流计算结果'"> </TitleLook>

        <div
          class="allDIV"
          style="
            height: auto;
            margin-bottom: 10px;
            box-shadow: none;
            border: none;
          "
        >
          <el-form
            :inline="true"
            :model="bottomForm"
            class="demo-form-inline"
            style="margin-left: 1%"
          >
            <el-form-item label="留存状态类型:">
              <el-select
                v-model="queryData.feederStatusType"
                placeholder="请选择"
                size="mini"
              >
                <el-option
                  v-for="item in statusTypeOptions"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-form>
        </div>

        <div class="underTitle" style="height: 70%">
          <CleanForm
            searShow="false"
            btnShow="false"
            :showColumnHandle="false"
            :api="CLlist"
            :queryParam="queryData"
            :fieldList="headList"
            :secondHeards="secondHeards"
            :tableOptionWidth="200"
            :showColumnSetting="false"
            :page="false"
            :dialogPage="true"
            :showExportBtn="false"
            :showCheckbox="false"
            ref="windPowerTable"
            size="mini"
          >
          </CleanForm>
        </div>
      </div>

      <el-dialog
        title="正在生成"
        :visible.sync="dialogVisible"
        width="30%"
        :before-close="handleClose"
        @opened="open()"
      >
        <span>
          <el-progress
            :percentage="percentage"
            :color="customColorMethod"
          ></el-progress>
        </span>
        <span>正在进行潮流计算，大约剩余10s生成储能容量规划</span>
        <span slot="footer" class="dialog-footer">
          <el-button type="primary" @click="cancel()">已完成</el-button>
        </span>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import { settings } from "nprogress";
import TestResult from "./index.js";
export default TestResult;
</script>
<style lang="scss" scoped>
::v-deep .el-tree {
  height: 100% !important;
  overflow-x: auto !important;
}

::v-deep .el-card__body {
  height: calc(95% - 20px) !important;
}

::v-deep .el-tree-node:focus > .el-tree-node__content {
  background-color: #f2f2f2;
}

.table-html-wrap {
  overflow: hidden;
  overflow-y: auto;
}

.table-html-wrap ::v-deep table {
  // color: red;
  border-right: 1px solid #000;
  border-bottom: 1px solid #000;
  border-collapse: collapse;
  margin: auto;
}

.table-html-wrap ::v-deep table td {
  border-left: 1px solid #000;
  border-top: 1px solid #000;
  white-space: nowrap;
  text-align: center;
  padding: 0.5rem;
}

.table-html-wrap ::v-deep tbody tr:nth-of-type(1) {
  font-weight: bold;
  font-size: 20px;
}

.dialog-footer {
  text-align: end;
}

.wrap {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;

  > div:nth-child(1) {
    width: 15%;
    height: 100%;
  }

  > div:nth-child(2) {
    width: 85%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding-left: 10px;

    .tableBox {
      width: 100%;
      margin-bottom: 10px;
      height: 60%;
      display: flex;
      flex-direction: row;
      justify-content: space-around;
    }
  }

  /* background-color: rgb(195, 188, 241); */
}

.chartBox {
  width: 70%;
  display: flex;
  flex-direction: column;
  // justify-content: center;
  height: 100%;
}

.rightBox {
  width: calc(30% - 10px);
  display: flex;
  flex-direction: column;
  // justify-content: center;
  height: 100%;

  margin-left: 10px;
}

.title {
  border: 1px solid grey;
  border-radius: 4px;
  width: 200px;
  text-align: center;
}

.operateButton {
  cursor: pointer;
  font-size: 12px !important;
  padding: 8px;

  img {
    transform: translateY(-2px);
  }
}

.operateButton::after {
  display: inline-block;
  content: "";
  width: 1px;
  height: 18px;
  margin: 0 3px;
  transform: translate(6px, 3px);
  background: #000;
}

.operateButton:last-child::after {
  display: none;
}

::v-deep .el-select--mini {
  width: 100%;
}

::v-deep .el-date-editor {
  width: 100%;
}

::v-deep .el-scrollbar__thumb {
  background: #000;
  display: none;
}

// ::-webkit-scrollbar-thumb {
//   // display: none;
// }
::v-deep .el-table__empty-block {
  justify-content: left;
  text-align: left;
  padding-left: 40%;
}

::v-deep .el-select-dropdown {
  position: absolute !important;
  top: 80% !important;
  left: 0px !important;
}

::v-deep .el-card {
  border-radius: 4px;
  border: 1px solid #ebeef5;
  background-color: #fff;
  overflow: visible !important; //溢出不隐藏   隐藏的话，下拉框看不到全部数据
  color: #303133;
  transition: 0.3s;
  height: 100%;
}

.allDIV {
  border-radius: 4px;
  border: 1px solid #ebeef5;
  background-color: #fff;
  overflow: visible !important; //溢出不隐藏   隐藏的话，下拉框看不到全部数据
  color: #303133;
  transition: 0.3s;
  height: 100%;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

.butStyle {
  background: rgb(1, 126, 129);
  color: #ffffff;
}

.underTitle {
  width: 100%;
  height: 90%;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-content: center;
}

.child_right {
  // @include child_left;
  width: 100%;
  height: 50%;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: baseline;
  // margin-top: 20%;
}

.left_text1 {
  display: flex;
  justify-content: center;
  text-align: center;
  align-content: center;
  vertical-align: middle;
  /* 垂直居中 */
  font-family: Source Han Sans CN;
  font-weight: bold;
  // font-size: 40px;
  color: #ffffff;
  background: linear-gradient(to bottom, #ffffff 0%, #8dc9ec 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.zerostyle {
  width: 20%;
  height: 100%;
  color: aliceblue;
  justify-content: space-around;
  display: flex;
  flex-direction: column;
  > div:nth-child(n) {
    background: linear-gradient(to top, rgb(76, 197, 176), rgb(119, 217, 230));

    border-radius: 5px;
    width: 90%;
    height: 20%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
  }
}

.right_bottom {
  width: 100%;
  height: 30%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-content: space-around;
  > div:nth-child(n) {
    width: 48%;
    height: 35%;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-content: center;
    > div:nth-child(n) {
      display: flex;
      flex-direction: column;
      width: 100%;
      justify-content: space-around;
      background: linear-gradient(
        to top,
        rgb(76, 197, 176),
        rgb(146, 218, 143)
      );
      width: 60%;
      border-radius: 10px;
      color: #fff;
      align-content: center;
    }
  }
}

:deep .el-form-item {
  margin-bottom: 0 !important;
}

.chartBox {
  width: 100%;
  display: flex;
  justify-content: center;
  height: 100%;
}
</style>
